home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-08-14 | 4.5 KB | 130 lines | [TEXT/MPS ] |
-
- ;*********************************************************************
- ;*********************************************************************
- ;
- ; File : PrimaryInit.a
- ; Description : This file contains the Primary Init code for the Apple
- ; video board, with information that is specific to
- ; the Apple video stubbed out (since locations and
- ; functions of the Apple video board may change,
- ; and the information is propriatary).
- ;
- ;*********************************************************************
- ;*********************************************************************
-
- ;=====================================================================
- ; Header
- ;=====================================================================
- DC.B sExec_2 ;Code revision (Primary init)
- DC.B sCPU_68020 ;CPU type is 68020
- DC.W 0 ;Reserved
- DC.L Begin-* ;Offset to code.
-
-
- ;=====================================================================
- ;PROCEDURE PrimaryInit(Slot:sInteger_8; VAR VendorStatus,Status:sInteger_16);
- ;=====================================================================
- ;BEGIN {Primary Init}
- WITH seBlock
-
- ; Set initial vendor status and save vars.
- Begin MOVE.W #1,seStatus(A0) ;VendorStatus <- 1 {Code was executed}
- MOVE.L A0,A3 ;save param block {A0 is destroyed}
-
-
- ; Turn the slot number into a base address.
- MOVEQ #0,D0 ;D0 <- 00000000
- MOVE.B seSlot(A0),D0 ;D0 <- 0000000s
- LSL.W #4,D0 ;D0 <- 000000s0
- OR.B seSlot(A0),D0 ;D0 <- 000000ss
- OR.W #$F00,D0 ;D0 <- 00000Fss
- SWAP D0 ;D0 <- 0Fss0000
- LSL.L #4,D0 ;D0 <- Fss00000
- MOVE.L D0,A2 ;A2 <- Base address to the slot.
-
-
- ; Reset the hardware.
- ; DO YOUR RESET STUFF HERE
-
- ; Set mode to one bit per pixel. ;
- ; DO YOUR MODE SETTING HERE
-
- ; Disable interrupts. ;
- MOVE.L A2,A0 ;get slot base
- ADD.L #DisableVInt,A0 ;Adjust the base
- CLR.B (A0) ;Disable interrupt from card
-
-
- ; set the color table to black and white
- ; SET THE TABLE HERE
-
-
- ; The Apple Video card configuration ROM has two video sResources conforming to the
- ; two possible different memory configurations. Now we want to figure out which
- ; of the configurations we have, and delete the incorrect video sResource from
- ; the slot resource table.
- ;
- ; size the RAM on the video card. To do this, we look for a nice longword in the second
- ; half of the frame buffer array that doesn't show up on the screen. I've selected the
- ; last longword of the first scanline that is a multiple of 8 in the second RAM bank (line 264).
- ; This alignment guarantees that this memory is off the right edge in all pixel depths
- ; when the frame buffer base addr is on a normal page boundary.
- ;
- ;
- ;
- TestPos EQU (265*1024)-4 ;
- TestPat EQU 'MAC2' ;test bit pattern
- WITH spBlock ;use the template
-
- SUBA #spBlockSize,SP ;make an SDM parameter block on stack
- MOVE.L SP,A0 ;get pointer to parm block now
- MOVE.B seSlot(A3),spSlot(A0) ;put slot in pBlock
- CLR.B spExtDev(A0) ;external device = 0
-
- MOVE.L #TestPos,D1 ;get offset in D1
- MOVE.L #TestPat,(A2,D1.L) ;write to alleged RAM
- MOVE.L #-1,-(SP) ;write out some garbage to clear data lines
- ADDQ #4,SP ;and pitch it
- MOVE.L (A2,D1.L),D0 ;read pattern back
- CMP.L #TestPat,D0 ;did it stick?
- BEQ.S @1 ;if equal, we have ram
- MOVE.B #sRsrc_Video8,spID(A0) ;if not, remove 8-bit table
- BRA.S @2
- @1
- MOVE.B #sRsrc_Video4,spID(A0) ;remove 4-bit table if we have ram
- @2
- _sDeleteSRTRec ;remove the invalid entry
- BNE.S @3 ;
- MOVE #2,seStatus(A3) ;mark the change
- @3 ADDA #spBlockSize,SP ;clean up
-
-
- ; Clear video RAM to a nice gray
- MOVE.L #$AAAAAAAA,D0 ;graypat1 := $AAAAAAAA
- MOVE.L D0,D1
- NOT.L D1
-
- MOVE.W #defScrnRow,D4 ;sRow := defScrnRow {Bytes per pixel line}
- MOVE.W #$200*4-1,D3 ;sHei := defScrnHeight {Screen Height in pixels}
-
- MOVE.L A2,A1 ;init row pointer ;REPEAT
- NxtRow MOVE.L A1,A0 ;get next row
- MOVE.W #defScrnRow/4-1,D2 ; rowlongs := defScrnRow/4 - 1 {How many Longs there are}
- NxtLong MOVE.L D0,(A0)+ ; (A0) := graypat(1/2)
- DBF D2,NxtLong ; UNTIL rowlongs < 0
- EXG D0,D1 ; graypat1 <-> graypat2
- ADD.W D4,A1 ; A2 := A2 + sRow
- DBF D3,NxtRow ;UNTIL sHei < 0
-
- ; Exit
- Exit RTS ;Return
-
- ENDWITH
-
- ;<PUT YOUR VALUES FOR INIT TABLE, OTHER TABLES, ETC. HERE IF NEEDED>
-
- ;END PrimaryInit
-
-
-
-